﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Plan;

namespace PlanVisualization
{
    /// <summary>
    /// Interaction logic for AssociationsWindows.xaml
    /// </summary>
    public partial class AssociationsWindows : Window
    {
        public AssociationsWindows()
        {
            InitializeComponent();
            DataContext = this;
        }



        public MainWindow.Associations Associations
        {
            get { return (MainWindow.Associations)GetValue(AssociationsProperty); }
            set { SetValue(AssociationsProperty, value); }
        }

        public static readonly DependencyProperty AssociationsProperty =
            DependencyProperty.Register("Associations", typeof(MainWindow.Associations), typeof(AssociationsWindows), new UIPropertyMetadata(null));

        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
        }

        private void GroupComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            GroupToSubjectListBox.ItemsSource = Associations.GroupToSubject[GroupComboBox.SelectedIndex];

        }

        private void AddToGroupButton_Click(object sender, RoutedEventArgs e)
        {
            GroupToSubjectListBox.ItemsSource = null;
            Associations.GroupToSubject[GroupComboBox.SelectedIndex].Add(SubjectListBox.SelectedIndex);
            GroupToSubjectListBox.ItemsSource = Associations.GroupToSubject[GroupComboBox.SelectedIndex];
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            Close();
        }

    }
}
